<template>
  <view>
    <view class="item" v-for="(item,index) in nearcar" :key="item.carId">
      <view class="left">
        <image :src="item.carHeadImg" mode="widthFix"></image>
      </view>
      <view class="right">
        <view class="carname">司机：{{item.carDriverName}}</view>
        <view class="carnumber">车牌：{{item.carNumber}}</view>
        <view class="distance">距你：{{item.distance.toFixed(0)}} 米</view>
      </view>
      <button>选择该司机</button>
    </view>
  </view>
</template>

<script>
  export default {
    created() {
      this.nearcar = this.$store.state.jhnearcar
      console.log(this.$store)
    },
    data() {
      return {
        nearcar:[]
      }
    },
    methods: {
      
    }
  }
</script>

<style scoped>
.item{
  margin: 10px 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.left{
  width: 80px;
  overflow: hidden;
  margin-right: 10px;
}
.left image{
  width: 80px;
  border-radius: 50%;
}
.right {
  flex: 1;
  font-size: 14px;
}

</style>
